package com.example.bnuzzu.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.example.bnuzzu.common.dto.HouseListDto;
import com.example.bnuzzu.common.dto.SearchDto;
import com.example.bnuzzu.entity.Houseinfo;
import com.example.bnuzzu.mapper.HouseinfoMapper;
import com.example.bnuzzu.service.HouseinfoService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author BNUZZU
 * @since 2021-04-13
 */
@Service
public class HouseinfoServiceImpl extends ServiceImpl<HouseinfoMapper, Houseinfo> implements HouseinfoService {
    @Autowired
    HouseinfoMapper houseinfoMapper;
    @Override
    public IPage<HouseListDto> selectHousePage(Page<HouseListDto> page, Integer state){
        page.setOptimizeCountSql(false);
        return houseinfoMapper.selectPageVo(page,state);
    }

    @Override
    public IPage<HouseListDto> searchHousePage(Page<HouseListDto> page, SearchDto searchDto, Integer state) {
        page.setOptimizeCountSql(false);
        return houseinfoMapper.searchPageVo(page,searchDto,state);
    }

    @Override
    public List<HouseListDto> getAllhouse() {
        return houseinfoMapper.getAllhouse();
    }

}
